package com.crazyauntzhang.easyshopbackend.dao;

import com.crazyauntzhang.easyshopbackend.domain.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;

@Mapper
@Repository
public interface UserDao {

	void insertUser(@Param("userID") String userID,
					@Param("username") String username,
					@Param("password") String password,
					@Param("roleID") String roleID,
					@Param("isOnJob") Boolean isOnJob,
					@Param("tel") String tel,
					@Param("hireDate") LocalDate hireDate);

	void updateUserOffJob(@Param("userID") String userID);

	User selectLoginUser(@Param("userID") String userID,
						 @Param("password") String password);

	List<User> selectAllUsers();

	Integer selectEmployeeCount();

	User selectUserOnJob(@Param("userID") String userID);

	User selectUserById(@Param("userID") String userID,
						@Param("isOnJob") Boolean isOnJob);

	List<User> selectUserByName(@Param("username") String username,
								@Param("isOnJob") Boolean isOnJob);

	void updateUser(@Param("userID") String userID,
					@Param("newUserID") String newUserID,
					@Param("username") String username,
					@Param("password") String password,
					@Param("roleID") String roleID,
					@Param("isOnJob") Boolean isOnJob,
					@Param("tel") String tel,
					@Param("hireDate") LocalDate hireDate);
}
